package com.wrupple.muba.common.domain;

import java.io.Serializable;
import java.util.ArrayList;

import com.google.gwt.user.client.rpc.IsSerializable;
import com.wrupple.muba.desktop.client.module.ModuleController.ModuleConfiguration;

public class Slice implements Serializable, IsSerializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 5618426170066208396L;

	/**
	 * 
	 */
	public Slice() {
	}

	protected ArrayList<ApplicationItem> items;
	private RawSlice raw;
	private ModuleConfiguration configurationObject;


	/**
	 * @return the items
	 */
	public ArrayList<ApplicationItem> getItems() {

		return items;
	}

	/**
	 * @param items
	 *            the items to set
	 */
	public void setItems(ArrayList<ApplicationItem> items) {
		this.items = items;
	}

	/**
	 * @return
	 */
	public RawSlice getRawApp() {
		return raw;
	}

	/**
	 * @param raw
	 */
	public void setRawApp(RawSlice raw) {
		if (raw != null) {
			this.raw = raw;
			if (this.raw.getSlice() != this) {
				this.raw.setSlice(this);
			}
		}
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see java.lang.Object#hashCode()
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((raw == null) ? 0 : raw.hashCode());
		return result;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Slice other = (Slice) obj;
		if (raw == null) {
			if (other.raw != null)
				return false;
		} else if (!raw.equals(other.raw))
			return false;
		return true;
	}

	public ModuleConfiguration getConfigurationObject() {
		return configurationObject;
	}

	public void setConfigurationObject(ModuleConfiguration configurationObject) {
		this.configurationObject = configurationObject;
	}
	

}
